﻿//自定义新增方法
var fnAddUser = function ()
{
    //    parent.addTabs("添加组员", '../message/orgbody.aspx?typeid=' + QString("otid"));
    //    parent.NeedRefreshPage = this;
    var para = QString("condition");
    document.getElementById("EditUIWindow").src = "../message/orgbody.aspx?typeid=" +para.substr(6,36) +"&r=" + Math.random();
    SetDWH(400, 350, YAHOO.example.container.dialog1);
    YAHOO.example.container.dialog1.show();
}

var fnAddToType = function (paras)
{

    var list = this.mDataTable.getRecordSet()._records;
    var gbids = "";
    var gbmob = "";
    dl = [];
    for (var i = 0; i < list.length; i++)
    {
        //this.getRecordSet()._records[0]._oData["BarItem"]
        if (list[i]._oData["iSun_Selected"] == true)
        {
            gbids += list[i]._oData[const_entityID] + ";";
            gbmob += list[i]._oData["Mobile"] + ";"; 
            dl.push(list[i]._sId); //获取行ID；
        }
    }
    if (gbids == "")
    {
        alert("请选择成员！");
        return;
    }
    var para = QString("condition");
    if (paras === undefined || paras == null)
    {
        document.getElementById("EditUIWindow").src = "../message/GroupBy.aspx?typeid=" + para.substr(6, 36) + "&r=" + Math.random() + "&gbids=" + gbids + "&gbmbs=" + encodeURI(gbmob);
    }
    else
    {
        document.getElementById("EditUIWindow").src = "../message/GroupBy.aspx?typeid=" + para.substr(6, 36) + "&r=" + Math.random() + "&gbids=" + gbids + "&gbmbs=" + encodeURI(gbmob) + "&type=DEL" ;
    }
    SetDWH(450, 350, YAHOO.example.container.dialog1);
    YAHOO.example.container.dialog1.show();
    parent.NeedRefreshPage = this;
}

var fnDeleteFromType = function ()
{
    fnAddToType("Del");

}

//只取一个URL参数：
var QString = function (key)
{
    return (document.location.search.match(new RegExp("(?:^\\?|&)" + key + "=(.*?)(?=&|$)")) || ['', null])[1];
}